/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.washburn.cm333.project.gui;

import java.awt.event.ActionEvent;

import javax.swing.*;

/**
 *
 * @author Midwest Health
 */
public class MainForm extends javax.swing.JFrame {

	public void MakeVisible() {
		this.setVisible(true);
	}

	public void Hide() {
		this.setVisible(false);
	}

	public MainForm() {
		initComponents();
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	//GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		btnNewTenant = new javax.swing.JButton();
		btnNewProperty = new javax.swing.JButton();
		btnNewLease = new javax.swing.JButton();
		jLabel1 = new javax.swing.JLabel();
		btnExit = new javax.swing.JButton();
		btnViewProperty = new javax.swing.JButton();
		btnViewLease = new javax.swing.JButton();
		btnViewTenant = new javax.swing.JButton();
		jMenuBar1 = new javax.swing.JMenuBar();
		jMenu1 = new javax.swing.JMenu();
		jMenuItem1 = new javax.swing.JMenuItem();
		mnuExit = new javax.swing.JMenuItem();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("Property Management Main");

		btnNewTenant.setText("New Tenant Form");
		btnNewTenant.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnNewTenantActionPerformed(evt);
			}
		});

		btnNewProperty.setText("New Property Form");
		btnNewProperty.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnNewPropertyActionPerformed(evt);
			}
		});

		btnNewLease.setText("New Lease Form");
		btnNewLease.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnNewLeaseActionPerformed(evt);
			}
		});

		jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18));
		jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		jLabel1.setText("Property Management");

		btnExit.setText("Exit");
		btnExit.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnExitActionPerformed(evt);
			}
		});

		btnViewProperty.setText("View Property");
		btnViewProperty.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnViewPropertyActionPerformed(evt);
			}
		});

		btnViewLease.setText("View Lease");
		btnViewLease.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnViewLeaseActionPerformed(evt);
			}
		});

		btnViewTenant.setText("View Tenant");
		btnViewTenant.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnViewTenantActionPerformed(evt);
			}
		});

		jMenu1.setText("File");

		jMenuItem1.setText("Preferences");
		jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jMenuItem1ActionPerformed(evt);
			}
		});
		jMenu1.add(jMenuItem1);

		mnuExit.setText("Exit");
		mnuExit.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				mnuExitActionPerformed(evt);
			}
		});
		jMenu1.add(mnuExit);

		jMenuBar1.add(jMenu1);

		setJMenuBar(jMenuBar1);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addComponent(
														jLabel1,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														580, Short.MAX_VALUE)
												.addGroup(
														layout.createSequentialGroup()
																.addGap(2, 2, 2)
																.addComponent(
																		btnViewTenant,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		184,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
																.addComponent(
																		btnViewProperty,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		184,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addGap(12, 12,
																		12)
																.addComponent(
																		btnViewLease,
																		javax.swing.GroupLayout.DEFAULT_SIZE,
																		186,
																		Short.MAX_VALUE))
												.addGroup(
														layout.createSequentialGroup()
																.addGap(2, 2, 2)
																.addComponent(
																		btnNewTenant,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		184,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
																.addComponent(
																		btnNewProperty,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		184,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
																.addComponent(
																		btnNewLease,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		184,
																		javax.swing.GroupLayout.PREFERRED_SIZE)))
								.addContainerGap())
				.addGroup(
						layout.createSequentialGroup()
								.addGap(130, 130, 130)
								.addComponent(btnExit,
										javax.swing.GroupLayout.DEFAULT_SIZE,
										335, Short.MAX_VALUE)
								.addGap(139, 139, 139)));
		layout.setVerticalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addComponent(jLabel1,
										javax.swing.GroupLayout.PREFERRED_SIZE,
										40,
										javax.swing.GroupLayout.PREFERRED_SIZE)
								.addGap(18, 18, 18)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addGroup(
														layout.createSequentialGroup()
																.addComponent(
																		btnNewTenant,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		62,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.BASELINE)
																				.addComponent(
																						btnViewTenant,
																						javax.swing.GroupLayout.PREFERRED_SIZE,
																						62,
																						javax.swing.GroupLayout.PREFERRED_SIZE)
																				.addComponent(
																						btnViewProperty,
																						javax.swing.GroupLayout.PREFERRED_SIZE,
																						63,
																						javax.swing.GroupLayout.PREFERRED_SIZE)
																				.addComponent(
																						btnViewLease,
																						javax.swing.GroupLayout.PREFERRED_SIZE,
																						63,
																						javax.swing.GroupLayout.PREFERRED_SIZE)))
												.addGroup(
														layout.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
																.addComponent(
																		btnNewProperty,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		63,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addComponent(
																		btnNewLease,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		63,
																		javax.swing.GroupLayout.PREFERRED_SIZE)))
								.addGap(41, 41, 41).addComponent(btnExit)
								.addGap(28, 28, 28)));

		pack();
	}// </editor-fold>
	//GEN-END:initComponents

	private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
		new Preferences().setVisible(true);
	}

	//GEN-END:initComponents

	private void btnViewTenantActionPerformed(java.awt.event.ActionEvent evt) {
		ViewTenantForm viewtenant = new ViewTenantForm();
		viewtenant.setVisible(true);
	}

	private void btnViewLeaseActionPerformed(java.awt.event.ActionEvent evt) {
		ViewLeaseForm viewlease = new ViewLeaseForm();
		viewlease.setVisible(true);
	}

	private void btnViewPropertyActionPerformed(java.awt.event.ActionEvent evt) {
		ViewPropertyForm viewproperty = new ViewPropertyForm();
		viewproperty.setVisible(true);
	}

	private void btnNewPropertyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewPropertyActionPerformed
		PropertyForm property = new PropertyForm();
		property.setVisible(true);
		//this.setVisible(false);
	}//GEN-LAST:event_btnNewPropertyActionPerformed

	private void btnNewTenantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewTenantActionPerformed
		TenantForm tenant = new TenantForm();
		tenant.setVisible(true);
		//this.setVisible(false);
	}//GEN-LAST:event_btnNewTenantActionPerformed

	private void btnNewLeaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewLeaseActionPerformed
		LeaseForm lease = new LeaseForm();
		lease.setVisible(true);
		//this.setVisible(false);
	}//GEN-LAST:event_btnNewLeaseActionPerformed

	private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExitActionPerformed
		System.exit(0);
	}//GEN-LAST:event_mnuExitActionPerformed

	private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExitActionPerformed
		System.exit(0);
	}//GEN-LAST:event_btnExitActionPerformed

	public static void main(String args[]) {
		/* Set the Nimbus look and feel */
		//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
		/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
		 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
		 */
		try {
			for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager
					.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					javax.swing.UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (ClassNotFoundException ex) {
			java.util.logging.Logger.getLogger(MainForm.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (InstantiationException ex) {
			java.util.logging.Logger.getLogger(MainForm.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (IllegalAccessException ex) {
			java.util.logging.Logger.getLogger(MainForm.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (javax.swing.UnsupportedLookAndFeelException ex) {
			java.util.logging.Logger.getLogger(MainForm.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		}
		//</editor-fold>

		/* Create and display the form */
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new MainForm().setVisible(true);
			}
		});
	}

	//GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.JButton btnExit;
	private javax.swing.JButton btnNewLease;
	private javax.swing.JButton btnNewProperty;
	private javax.swing.JButton btnNewTenant;
	private javax.swing.JButton btnViewLease;
	private javax.swing.JButton btnViewProperty;
	private javax.swing.JButton btnViewTenant;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JMenu jMenu1;
	private javax.swing.JMenuBar jMenuBar1;
	private javax.swing.JMenuItem jMenuItem1;
	private javax.swing.JMenuItem mnuExit;
	// End of variables declaration//GEN-END:variables
}
